package io.renren.modules.shop.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.shop.entity.CheckingEntity;
import io.renren.modules.shop.service.CheckingService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author LL
 * @email wdlyl@163.com
 * @date 2022-04-12 14:48:24
 */
@RestController
@RequestMapping("car/checking")
public class CheckingController {
    @Autowired
    private CheckingService checkingService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("car:checking:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = checkingService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{recordingId}")
    @RequiresPermissions("car:checking:info")
    public R info(@PathVariable("recordingId") String recordingId){
		CheckingEntity checking = checkingService.getById(recordingId);

        return R.ok().put("checking", checking);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("car:checking:save")
    public R save(@RequestBody CheckingEntity checking){
		checkingService.save(checking);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("car:checking:update")
    public R update(@RequestBody CheckingEntity checking){
		checkingService.updateById(checking);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("car:checking:delete")
    public R delete(@RequestBody String[] recordingIds){
		checkingService.removeByIds(Arrays.asList(recordingIds));

        return R.ok();
    }

}
